home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
pbaseiv.zip
/
P4DOS005.TIP
< prev
next >
Wrap
Text File
|
1991-12-16
|
2KB
|
52 lines
I use UNIX as well as DOS, and I prefer its "rm" (remove)
command to DOS's DEL and ERASE as a way of deleting files.
"rm" lets you delete many files by specifying them all in
one command line, e.g. "rm fhm.* *.doc *.dat test.drw
*.dwg"--something DEL could never dream of. To bring this
old UNIX friend into the DOS world, I developed a batch
file, RM.BAT [see listing]. Put this file in a directory on
your path, and you can delete up to nine files or wild-card
file groups. Note that if you're using an earlier version of
DOS than 3.1, you need to remove the @ sign at the beginning
of the `Echo off' command in this file.
Faheem Ahmad
Blacksburg, Virginia
Editor's note: This batch file is an excellent demonstration
of the DOS SHIFT command, which "steps" through a list of
batch file arguments so %2 becomes %1 and %3 becomes %2,
etc. This allows you to process many parameters in a loop.
The OS/2 shell's ERASE and DEL commands already allow
multiple file specs, but Microsoft hasn't added them to DOS
for fear of creating incompatibilities. To extract this
batch file for your own use, use the Alt-F command, sending
the listing to a file called RM.BAT in a directory on your
path.
RM.BAT
---- BEGIN LISTING ----
@echo off
if "%1"=="" goto MSG
if "%1"=="/?" goto MSG
:START
if "%1"=="" goto END
erase %1
shift
goto START
:MSG
echo Deletes the files listed
echo on the command line.
echo Wildcards are allowed.
echo RM file [file [file...]]
:END
@echo on
---- END LISTING ----
Title: Delete Tall Heaps of Files in a Single Bound
Category: DOS
Issue date: Aug 1991
Editor: Brett Glass
Supplementary files: NONE